<template>
  <el-form ref="formRef" :model="form" label-position="top" :label-width="140">
    <div class="grid grid-cols-3 gap-x-3">
      <el-form-item label="建单数量" prop="process_num" :rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
        <el-input-number v-model="form.process_num" controls-position="right" :min="0" :step="1" :precision="0"
          class="w-full" />
      </el-form-item>
      <el-form-item label="sku" prop="sku" :rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
        <el-input v-model="form.sku" placeholder="账号类型" class="w-full" />
      </el-form-item>
      <el-form-item label="采购单价">
        <el-input-number v-model="form.unit_price" controls-position="right" :min="0" :step="0.01" :precision="2"
          class="w-full" />
      </el-form-item>
    </div>
  </el-form>
</template>

<script setup>
const props = defineProps({
  modelValue: { type: Object, default: () => ({}) },
  options: { type: Object, default: () => ({}) },
})
const emit = defineEmits(['update:modelValue'])
const form = computed({
  get() {
    return props.modelValue
  },
  set(val) {
    emit('update:modelValue', val)
  }
})
const formRef = ref()
const validate = async () => await formRef?.value.validate(res => res)
defineExpose({ validate })
</script>